package com.bootssm.service.impl;

import com.bootssm.dao.PlayerMapper;
import com.bootssm.enity.Player;
import com.bootssm.enity.PlayerQueryVO;
import com.bootssm.enity.Result;
import com.bootssm.service.PlayerService;
import com.bootssm.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Service
public class PlayerServiceImpl implements PlayerService {

    @Autowired
    PlayerMapper playerMapper;
    @Autowired
    IdWorker idWorker;

    @Override
    public List<Player> findAll(PlayerQueryVO playerQueryVO) {
        return playerMapper.findAll(playerQueryVO);
    }

    @Override
    public void addPlayer(Player player) {
        player.setPlayerid(idWorker.nextId()+"");
        player.setDictionid("1");
        playerMapper.addPlayer(player);
    }

    @Override
    public void deletePlayer(String playerid) {
         playerMapper.deletePlayer(playerid);
    }

    @Override
    public void updatePlayer(Player player) {
        playerMapper.updatePlayer(player);
    }

    @Override
    public Player findById(String playerId) {
        return playerMapper.findById(playerId);
    }

    @Override
    public Integer getCount(PlayerQueryVO playerQueryVO) {
        return playerMapper.getCount(playerQueryVO);
    }

}
